package com.cn.kabalifemerchants.ui.login.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.cn.kabalifemerchants.R;
import com.cn.kabalifemerchants.ui.login.bean.CooperationSreviceListBean;
import com.flyco.roundview.RoundTextView;

import java.util.List;

/**
 * Created by 晓林 on 2020/10/20.
 * function:
 */
public class SreviceTypeToAdapter extends BaseQuickAdapter<CooperationSreviceListBean.ResultBean.ChildrenBean, BaseViewHolder> {


    boolean isCheck;

    public SreviceTypeToAdapter(int layoutResId, @Nullable List<CooperationSreviceListBean.ResultBean.ChildrenBean> data, boolean isCheck) {
        super(layoutResId, data);
        this.isCheck = isCheck;
    }

    @Override
    protected void convert(BaseViewHolder helper, final CooperationSreviceListBean.ResultBean.ChildrenBean item) {
        RoundTextView tv_name = helper.getView(R.id.tv_name);
        tv_name.setText(item.getTitle());
        if (isCheck) {
            if (item.isCheck()) {
                tv_name.getDelegate().setBackgroundColor(this.mContext.getResources().getColor(R.color.main_color));
                tv_name.setTextColor(this.mContext.getResources().getColor(R.color.main_white));
            } else {
                tv_name.getDelegate().setBackgroundColor(this.mContext.getResources().getColor(R.color.text_bg));
                tv_name.setTextColor(this.mContext.getResources().getColor(R.color.font_000));
            }
        } else {
            tv_name.getDelegate().setBackgroundColor(this.mContext.getResources().getColor(R.color.text_bg));
            tv_name.setTextColor(this.mContext.getResources().getColor(R.color.font_000));
        }
    }

}
